home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / APP / M-R / PSpice.cpt / Example1.cir < prev    next >
Text File  |  1990-09-13  |  10KB  |  236 lines

  1. EXAMPLE1 - An Illustration of PSpice Capabilities
  2. * This circuit, a differential pair, shows many of the capabilities of PSpice.
  3. * It creates a large amount of output for such a small circuit.  Normally,
  4. * only a few kinds of analysis, such as transient analysis, would be run.
  5. * This command sets options for the run.
  6. .OPT ACCT NOMOD NOPAGE RELTOL=.001
  7.  
  8. * Sets the width of the output to 80 columns.
  9. .WIDTH OUT=80
  10.  
  11. * Sets the temperature for the run to 35 degrees celsius.
  12. .TEMP 35
  13.  
  14. * This command does a DC sweep.  The voltage source VIN is swept from
  15. *   -0.125 volts to 0.125 volts in steps of 0.005 volts.  The non-linear
  16. *   device equations are used.
  17. .DC VIN -0.125 0.125 0.005
  18.  
  19. * There is no command to do a small-signal bias point calculation.  It
  20. *   is done automatically after the DC sweep is finished.  The non-linear
  21. *   device equations are used to find the bias point.  Then, the linearized,
  22. *   small-signal equivalent circuit at the bias point is saved for the .TF,
  23. *   .SENS, .AC, and .NOISE analysis.  This command prints out the small-
  24. *   signal parameters for each device.
  25. .OP
  26.  
  27. * This command does a small-signal transfer function calculation assuming
  28. *   VIN is the input and V(5), the voltage at node 5, is the output.
  29. .TF V(5) VIN
  30.  
  31. * This does an AC analysis.  The real and imaginary response of the circuit
  32. *   is calculated as the inputs are swept from 100 kilohertz to 10 gigahertz
  33. *   by decades with 10 points per decade.  The only AC input this circuit has
  34. *   is VIN.  This is a linear analysis.
  35. .AC DEC 10 100KHZ 10GHZ
  36.  
  37. * This command does noise calculations during the AC analysis.  Each
  38. *   device's noise contribution is calculated and propogated to node 5.
  39. *   All the contributions are rms-summed at node 5.  Besides the total
  40. *   output noise printout done for every frequency, a detailed table of
  41. *   each device's contribution is done every 30'th frequency.
  42. .NOISE V(5) VIN 30
  43.  
  44. * This command does a transient analysis.  It first re-calculates the
  45. *   circuit's bias point, then calculates the circuit's time response
  46. *   from 0 nanoseconds to 250 nanoseconds using the full, non-linear device
  47. *   equations, including non-linear capacitances.  PSpice uses a variable
  48. *   time step for the calculations, but this command causes the results
  49. *   to be interpolated onto a 5 nanosecond print interval.  Transient
  50. *   analysis is the most frequently used analysis in PSpice.
  51. .TRAN 20NS 1000NS
  52.  
  53. * This does a harmonic decomposition on the waveform V(5) calculated
  54. *   during transient analysis.  It calculates the magnitude and phase
  55. *   of the fundamental (5 megahertz) and the first eight harmonics.
  56. *   The graphics post-processor, Probe, goes further and contains
  57. *   a full FFT, allowing complete spectra to be displayed.
  58. .FOUR 5MEG V(5)
  59.  
  60. * This command does a Monte Carlo analysis of the circuit.  It runs
  61. *   the DC sweep 5 times using the tolerances in .MODEL statements
  62. *   and compares the waveform V(4,5) from each run against the nominal
  63. *   V(4,5).  It then lists a table of each run's deviation from the 
  64. *   nominal.  The Monte Carlo option can also do Worst Case and Sensitivity
  65. *   analysis.
  66. .MC 5 DC V(4,5) YMAX
  67.  
  68. * PSpice allows parameters to be defined and used in expressions
  69. *   throughout the circuit file.  Parameters may also be passed into
  70. *   subcircuits as arguments and used inside.  Here, we define a
  71. *   fudge factor for the supply voltages.
  72. .PARAM FACTOR=1.2
  73.  
  74. * The following statements describe the circuit to PSpice.  It is a
  75. *   simple differential pair, with +12 and -12 volts as the supplies.
  76.  
  77. * VIN is the input for this circuit.  It has an amplitude during AC analysis
  78. *   of 1 volt and a sine waveform during transient of .1 volt at 5 megahertz.
  79. VIN 100 0 AC 1 SIN(0 0.1 5MEG)
  80.  
  81. * The power supplies are + and - SUPPLY volts.  As mentioned above,
  82. *   expressions containing parameters can be used for values throughout
  83. *   the circuit file.  Expressions are enclosed by "{" and "}" and allow
  84. *   arithmetic expressions.
  85. VCC 101 0 DC {10*FACTOR}
  86. VEE 102 0 {-10*FACTOR}
  87.  
  88. * The transistors' nodes are in the order collector - base - emitter.
  89. *   All transistors must refer to a model (QNL in this case).
  90. Q1 4 2 6 QNL
  91. Q2 5 3 6 QNL
  92.  
  93. * Models for resistors are optional.  If used they can specify such things
  94. *   as scaling, temperature coefficients, and tolerances.
  95. RS1 100 2 1K 
  96. RS2 3 0 1K
  97. RC1 4 101 CRES 10K
  98. RC2 5 101 CRES 10K
  99. Q3 6 7 102 QNL
  100. Q4 7 7 102 QNL
  101. RBIAS 7 101 20K
  102. CLOAD 4 5 5PF
  103.  
  104. * This statement describes the CRES resistor by giving the values for
  105. *   the parameters.  Each type of model has its own set of parameters.
  106. *   All parameters have default values.  In CRES we have set the scaling
  107. *   factor to 1, the linear temperature coefficient to .02, and the
  108. *   quadratic temperature coefficient to .0045, and given each resistor
  109. *   a 5% tolerance on its value during Monte Carlo analysis.
  110. .MODEL CRES RES (R=1 DEV=5% TC1=.02 TC2=.0045)
  111.  
  112. * The bipolar transistor model is the Gummel-Poon model.  It uses the
  113. *   same equations as in the UC Berkeley Spice program.  There are
  114. *   actually 55 model parameters, but most of these are for second-order
  115. *   effects that are rarely used.  Most bipolar models for realistic
  116. *   circuits specify between 12 and 25 parameters and default the rest.
  117. *   Here, we have set the forward beta to 80, the base resistance to
  118. *   100 ohms, the collector-substrate capacitance to 2 picofarads, the
  119. *   forward transit time to 0.3 nanoseconds, the reverse transit time to
  120. *   6 nanoseconds, the base-emitter capacitance to 3 picofarads, the
  121. *   base-collector capacitance to 2 picofarads, and the forward Early
  122. *   voltage to 50 volts.  The capacitances are actually voltage dependent.
  123. *   These numbers are the zero-bias values.
  124. .MODEL QNL NPN (BF=80 RB=100 CCS=2PF TF=0.3NS TR=6NS CJE=3PF CJC=2PF
  125. +   VA=50)
  126.  
  127. * The Analog Behavioral Modeling option allows one to define a transfer
  128. *   function by formula and/or by table.  Here, we implement an ideal
  129. *   comparator to convert the differential output across nodes 4 and 5 into
  130. *   a TTL output on node 10.  The voltage across 4 and 5 is multiplied by 1e5
  131. *   and that value is looked up in the table.  The table has an output of 0v
  132. *   for inputs < 0, 5v for inputs > 5, and output=input in between.
  133. *   So, the comparator has a gain of 100,000 and saturates at 0v and 5v.
  134. * Although not shown here, one can also define linear transfer functions
  135. *   by Laplace transform formulas or by frequency response tables.
  136. E1    10 0    TABLE {V(4,5)*1e5}    (0v,0v 5v,5v)
  137. RE1    10 0    1K
  138.  
  139. * The Digital Simulation option simulates digital components.  Instead
  140. *   of voltages and waveforms, it calculates 1's and 0's and propogation
  141. *   delays.  PSpice automatically creates interface components between
  142. *   analog and digital sections or circuitry.  Here, we drive a 74293,
  143. *   4-bit, ripple counter from the output of the comparator E1.
  144.  
  145. X1 10 QA 110 110 QA QB QC QD 74293
  146.  
  147. * This is a digital stimulus which resets the counter
  148. U2 STIM(1, 1) 110 STMIOMDL TIMESTEP = 10NS
  149. +   0nS, 1
  150. +  40nS, 0
  151.  
  152. * These commands provide print and plot output for selected voltages
  153. *   and currents.  The plots are the so-called "line printer" plots.
  154. *   That is, plots made out of characters.  To get real, high-resolution
  155. *   plots you need to use Probe; it is invoked by the .PROBE command.
  156. .PRINT DC V(4) V(5)
  157. .PLOT DC IC(Q2) 
  158. .PLOT AC VCM(Q2) VCP(Q2)
  159. .PLOT NOISE INOISE ONOISE 
  160. .PLOT TRAN V(4,5) V(10)    D(QA) D(QB)
  161. .PROBE
  162.  
  163. * We have included the full subcircuit and model definitions here in
  164. *   order to make the EXAMPLE1.CIR file self-contained.  These models
  165. *   come from the digital library files and would normally be accessed
  166. *   by using a .LIB command instead of reproducing them in the circuit
  167. *   file.
  168. .SUBCKT 74293 CKA CKB R01 R02 QA QB QC QD
  169. U1 NAND(2) R01 R02 RBAR D0_GATE IO_DFT
  170. U2 JKFF(1) $D_HI RBAR CKA $D_HI $D_HI QA $D_NC D_293ASTD IO_STD
  171. U3 JKFF(1) $D_HI RBAR CKB $D_HI $D_HI QB $D_NC D_293BSTD IO_STD
  172. U4 JKFF(1) $D_HI RBAR QB  $D_HI $D_HI QC $D_NC D_293BSTD IO_STD
  173. U5 JKFF(1) $D_HI RBAR QC  $D_HI $D_HI QD $D_NC D_293BSTD IO_STD
  174. .ENDS
  175.  
  176. .MODEL D0_GATE UGATE
  177. .MODEL IO_DFT  UIO (DRVH=50 DRVL=50 AtoD=STDATOD DtoA=STDDTOA)
  178. .MODEL IO_STD  UIO (DRVH=60 DRVL=30 AtoD=STDATOD DtoA=STDDTOA)
  179.  
  180. .MODEL D_293ASTD UEFF (
  181. + TPPCQHLTY   = 26ns TPPCQHLMX   = 40ns
  182. + TPCLKQLHTY  = 10ns TPCLKQLHMX  = 16ns
  183. + TPCLKQHLTY  = 12ns TPCLKQHLMX  = 18ns
  184. + TWCLKHMN    = 15ns TWCLKHTY    = 15ns TWCLKHMX    = 15ns
  185. + TWCLKLMN    = 15ns TWCLKLTY    = 15ns TWCLKLMX    = 15ns
  186. + TSUPCCLKHMN = 25ns TSUPCCLKHTY = 25ns TSUPCCLKHMX = 25ns
  187. + TWPCLTY     = 15ns TWPCLMX     = 15ns )
  188.  
  189. .MODEL D_293BSTD UEFF (
  190. + TPPCQHLTY   = 26ns TPPCQHLMX   = 40ns
  191. + TPCLKQLHTY  = 10ns TPCLKQLHMX  = 16ns
  192. + TPCLKQHLTY  = 14ns TPCLKQHLMX  = 21ns
  193. + TWCLKHMN    = 30ns TWCLKHTY    = 30ns TWCLKHMX    = 30ns
  194. + TWCLKLMN    = 30ns TWCLKLTY    = 30ns TWCLKLMX    = 30ns
  195. + TSUPCCLKHMN = 25ns TSUPCCLKHTY = 25ns TSUPCCLKHMX = 25ns
  196. + TWPCLTY     = 15ns TWPCLMX     = 15ns )
  197.  
  198. *
  199. * The digital power supply subckt:
  200. *  one instance of this subcircuit is created if any AtoD or DtoA
  201. *  subckts are created.  The one interface pin is always given the 
  202. *  value "0".
  203. .subckt    digifpwr gnd
  204. vdigpos $G_dig_pos $G_dig_neg 5v
  205. r1      $G_dig_pos gnd   1MEG
  206. vdigneg $G_dig_neg gnd   0v
  207. r2      $G_dig_neg gnd   1MEG
  208. vdigref $G_dig_ref gnd   0v
  209. r3      $G_dig_ref gnd   1MEG
  210. .ends
  211.  
  212. .model stmiomdl UIO (drvh=0 drvl=0 AtoD=STDATOD DtoA=STDDTOA)
  213.  
  214. * Simple AtoD and DtoA subckts: use globals to connect to power supply
  215. .subckt stdAtoD a d
  216. o1 a $G_dig_ref DOTTLSCH Dgtlnet = d  IO_STD
  217. .ends
  218.  
  219. .subckt stdDtoA d a
  220. n1 a $G_dig_neg $G_dig_pos DIN74 dgtlnet = d  IO_STD
  221. .ends
  222.  
  223. .model DIN74 dinput(
  224. +    s0name = 0, s0tsw = 5ns, s0rlo = 8.54 s0rhi = 238.9,
  225. +    s1name = 1, s1tsw = 8ns, s1rlo = 486  s1rhi = 209,
  226. +    s2name = X, s2tsw = 4ns, s2rlo = 64.4 s2rhi = 90.1,
  227. +    s3name = Z, s3tsw = 8ns, s3rlo = 100k s3rhi = 100k)
  228.  
  229. .model DOTTLSCH doutput(
  230. +    s0name = 0, s0vlo = -1.5, s0vhi = 1.4,
  231. +    s1name = 1, s1vlo = 1.40, s1vhi = 7.0)
  232.  
  233. .END
  234.